import 'package:flutter/material.dart';

import 'pages/home.dart';
import 'pages/market.dart';
import 'pages/me.dart';

class LoanBoxApp extends StatefulWidget {

  @override
  LoanBoxAppState createState() => new LoanBoxAppState();
}

class LoanBoxAppState extends State<LoanBoxApp> with SingleTickerProviderStateMixin{
  TabController controller;
  @override
  void initState() {
    controller = new TabController(length: 3, vsync: this);
  }

  void dispose() {
    controller.dispose();
    super.dispose();
  }

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        body: TabBarView(
          controller: controller,
          children: [
            new Home(),
            new Market(),
            new Me(),
          ],
        ),
        bottomNavigationBar: new Material(
          color: Colors.blue,
          child: new TabBar(
            controller: controller,
            tabs: [
              new Tab(
                text: "首页",
                icon: new Icon(
                  Icons.home,
                ),
              ),
              new Tab(
                text: "贷款超市",
                icon: new Icon(
                  Icons.monetization_on,
                ),
              ),
              new Tab(
                text: "我的",
                icon: new Icon(
                  Icons.perm_identity,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}